package com.songcha.sakura.download.base

import android.os.Parcelable
import com.songcha.sakura.download.base.DownloadDelegate
import com.songcha.sakura.download.base.DownloadOption

enum class TaskState {
    PRE,
    INITIALIZE,
    PAUSE,
    DOWNLOADING,
    COMPLETED,
    ERROR
}

 abstract class DownloadTask(val option: DownloadOption) :Parcelable {
    var id=0
    var tId=0L//线程id
    var url=""
    //var fileName=""
    var currentSize=0
    var fileSize=0
    var progress=0

    var state=TaskState.PRE

    lateinit var downloadDelegate: DownloadDelegate


    constructor(url:String,option: DownloadOption):this(option){
        this.url=url
    }

    open fun setProgress(){
        progress=(((currentSize)*1.0)/fileSize*100).toInt()
    }





 }